From: Florian Müllner Date: Sun, 16 Jul 2023 12:40:08 +0000 (+0200) Subject: extensionSystem: Include dir and path in data passed to extension X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~337^2~1^2~100 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=1c98a95974ae924bb93617d4badccbbb5bc0c900;p=gnome-shell.git extensionSystem: Include dir and path in data passed to extension Extensions often need to set up additional resources from their directory, like settings, translations or image assets. So far extensions have used getCurrentExtension() to access the shell's internal extension object which contains path and dir properties. That's far from ideal, first because it requires generating a stack to figure out the current extension, and second because the internal object also contains state that extensions shouldn't meddle with. Just include those properties in the metadata we pass to the extension constructor. Part-of: --- diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index abe98b574..d2f608f4c 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -536,7 +536,9 @@ var ExtensionManager = class extends Signals.EventEmitter { } try { - extensionState = new extensionModule.default(extension.metadata); + const {metadata, path} = extension; + extensionState = + new extensionModule.default({...metadata, dir, path}); } catch (e) { this.logExtensionError(uuid, e); return false;